package com.jmcgg.freesky.common.db;

import java.io.Serializable;

import java.sql.DriverManager;

/**
 * Title: F<br>
 * mmon Java Library <br>
 * Description: FreeSky Common Java Library <br>
 * Copyright: Copyright (c) 2005~2009 www.afss.cn <br>
 * Company: Amei's FreeSky Studio <br>
 * 
 * @author <b>Jacky Chou</b> (AFSS [Amei's FreeSky Studio])
 * @version 1.2.0, 2008-02-23, Upgrade freesky.jar to 1.2.0 with Struts 2
 * @version 1.0.0, 2006-05-30, Initial Version
 */
public class DBMySQLBean extends DBConnBean implements Serializable {
	/* <br> */
	private static final long serialVersionUID = 5304958154746452105L;
	public static String URL = "jdbc:mysql://localhost/test";
	public static String USER = "root";
	public static String PASSWORD = "sql";

	public DBMySQLBean() {
		super();
	}

	public void getConnection() {
		try {
			Class.forName("org.gjt.mm.mysql.Driver");
			conn = DriverManager.getConnection(URL, USER, PASSWORD);
		} catch (java.lang.ClassNotFoundException ce) {
			logger.error("Get Connection error:", ce);
		} catch (java.sql.SQLException se) {
			logger.error("Get Connection error:", se);
		} catch (Exception e) {
			logger.error("Get Connection error:", e);
		}
	}

	/*
	 * ���� Javadoc��
	 * 
	 * @see afss.freesky.common.db.IDBConn#setDBConnInfo(java.lang.String,
	 * java.lang.String, java.lang.String, java.lang.String)
	 */

	public void setDBConnInfo(String dbIP, String dbName, String dbUser,
			String dbPassword) {
		URL = "jdbc:mysql://" + dbIP + "/" + dbName;
		USER = dbUser;
		PASSWORD = dbPassword;
	}
}
